<?php
namespace app\swoole\model;

class TaskRunlog extends \think\Model {

    protected $pk = 'id';

    public function addLog($data) {
        $log_info = [
            'schedule_id' => $data['id'],
            'plan_start_time' => $data['plan_start_time'],
            'task_data' => json_encode($data, JSON_UNESCAPED_UNICODE),
        ];
        $this->data($log_info, true)->isUpdate(false)->save();
        $data['log_id'] = $this->id;
        return $data;
    }

}
